package com.ljx.controller;


import com.ljx.R;
import com.ljx.client.UcenterInterface;
import com.ljx.service.impl.StatisticsDailyServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author 李加喜
 * @since 2020-10-02
 */
@RestController
@RequestMapping("/staservice/sta")
@CrossOrigin
public class StatisticsDailyController {
    @Autowired
    private UcenterInterface ucenterInterface;
    @Autowired
    private StatisticsDailyServiceImpl staService;
    //统计某一天注册的人数
    @PostMapping("/registerCount/{day}")
    public R registerCount(@PathVariable String day){
        staService.registerCount(day);
        return R.ok();
    }
    //图标显示,返回两部分数据,日期json数组,数量json数组
    //这里可以传递三个值 也可以传递对象进行封装
    @GetMapping("/showData/{type}/{begin}/{end}")
    public R showData(@PathVariable String type, @PathVariable String begin, @PathVariable String end){
        Map<String,Object> map=staService.getShowData(type,begin,end);
        return R.ok().data(map);
    }
    //实现图表显示
    @GetMapping("/bing/{type}/{begin}/{end}")
    public R showDataBing(@PathVariable String type, @PathVariable String begin, @PathVariable String end){
        Map<String,Object> map=staService.getshowDataBing(type,begin,end);
        return R.ok().data(map);
    }
}

